package com.ylbh.modules.cashaudit.controller;

import com.ylbh.common.pojo.cashaudit.dto.DiscountRecordDTO;
import com.ylbh.common.utils.CommonResult;
import com.ylbh.common.utils.PageUtils;
import com.ylbh.common.utils.Ref;
import com.ylbh.modules.cashaudit.service.BusinessWithRecordService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping(value = "cashAudit")
public class DiscountRecordController {

    @Autowired
    public BusinessWithRecordService businessWithRecordService;

    @ApiOperation("提现记录")
    @RequestMapping("queryDiscountRecordList")
    @RequiresPermissions("cashAudit:queryDiscountRecordList")
    public CommonResult<PageUtils> queryDiscountRecordList(DiscountRecordDTO discountRecordDTO) {
        PageUtils list = businessWithRecordService.queryDiscountRecordList(discountRecordDTO);
        return Ref.ok(list);
    }

    @ApiOperation("提现记录导出")
    @RequestMapping("cashWithdrawalRecordExcel")
    public CommonResult cashWithdrawalRecordExcel(HttpServletRequest request, HttpServletResponse response) throws Exception{
        businessWithRecordService.cashWithdrawalRecordExcel(request, response);
        return Ref.ok();
    }
}
